package com.controller.experiment;


import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//自定义控制器
public class MyControllerImpl implements MyController {

    @Override
    public ModelAndView myTest(HttpServletRequest request,
                               HttpServletResponse response) throws Exception {
        ModelAndView mv = null;
        if ("zk".equals(request.getParameter("username"))) {
            if ("123".equals(request.getParameter("password"))) {
                mv = new ModelAndView("hello");
                mv.addObject("username",request.getParameter("username"));
            } else {
                mv = new ModelAndView("error");
                mv.addObject("msg", "密码错误");
            }
        } else {
            mv = new ModelAndView("error");
            mv.addObject("msg","用户名错误");
        }
        return mv;
    }
}
